const mongoose = require('mongoose')

mongoose.connect('mongodb://admin:123456@localhost/feedBook?authSource=admin', {useNewUrlParser: true, useUnifiedTopology: true})
    .then(() => {
        console.log('monogo连接成功')
    })
    .catch((e: any) => {
        console.log('monogo连接失败')
        throw e

    })

const bookSchema = new mongoose.Schema({
    title: String,
    author: String,
    published: String,
    updated: String,
    language: String,
    issued: String,
    category: String,
    summary: String,
    extent: Number,
    source: String,
    epubUrl: String,
    coverUrl: String,
})

export const bookModel = mongoose.model('bookModel', bookSchema)

export default mongoose